home *** CD-ROM | disk | FTP | other *** search
/ 130 MIDI Tool Box / 130 MIDI Tool Box.iso / pc800 / pc801.c < prev    next >
Text File  |  1987-10-25  |  5KB  |  170 lines

  1. #include"\c\colors.h"
  2. #include<stdarg.h>
  3. #include<stdlib.h>
  4. #include<stdio.h>
  5.  
  6. #include<dos.h>
  7.  
  8. /* roland jx-8p programmer/sound librarian */
  9.  
  10. /*------------------------------------------------------------------*/
  11. extern int done;
  12. /*------------------------------------------------------------------*/
  13. handle_midi() { receive_midi_packet(); }    /* called by midi int routine */
  14. receive_midi_packet()
  15.          { int a;
  16.            do {
  17.            do  {} while (!(kbhit()||dta_rdy()));
  18.            if (kbhit()) handle_kbd();
  19.            if (dta_rdy()) {
  20.                        a=rc_dta();
  21.                        switch (a) {
  22.                             case 0x90:  note(); break;
  23.                             case 0x80:  note_off(); break;
  24.                             case 0xb0:  modulation(); break;
  25.                             case 0xc0:  program_change(); break;
  26.                             case 0xd0:  after_touch(); break;
  27.                             case 0xe0:  pitch_bend(); break;
  28.                             case 0xf0:  midi_exclusive(); break;
  29.                             case 0xfe:  break; /* ack */
  30.                                   }
  31.                         }
  32.                } while(!done);
  33.          }
  34.  
  35. /*------------------------------------------------------------------*/
  36. after_touch()
  37.      {
  38.        rc_dta_wt();
  39.      }
  40. /*------------------------------------------------------------------*/
  41. pitch_bend()
  42.      {
  43.        rc_dta_wt();
  44.      }
  45. /*------------------------------------------------------------------*/
  46. modulation()
  47.      {
  48.        rc_dta_wt(); rc_dta_wt();  /* discard it */
  49.      }
  50. /*------------------------------------------------------------------*/
  51. program_change()
  52.      {
  53.        rc_dta_wt();
  54.      }
  55. /*------------------------------------------------------------------*/
  56. note_off()
  57.     {
  58.       rc_dta_wt(); rc_dta_wt();  /* discard it */
  59.     }
  60. /*------------------------------------------------------------------*/
  61. note()
  62.     {
  63.       rc_dta_wt(); rc_dta_wt();  /* discard it */
  64.     }
  65. /*------------------------------------------------------------------*/
  66. wait_key()
  67. {
  68.  printf("\nhit any key to continue...\n");
  69.  while (!kbhit()) {};
  70.  getch();
  71. }
  72. /*------------------------------------------------------------------*/
  73. shell()
  74. {
  75. /* invoke dos shell */
  76.  int error;
  77.  screen(1);
  78.  color(normal);
  79.  printf("\nDOS Shell - enter exit to return\n");
  80.  color(normal);
  81.  error=system("command.com");
  82.  if (error!=0) { color(yellow); printf("return code=%x",error); }
  83.  color(normal);
  84.  wait_key();
  85.  screen(0);
  86. }
  87. /*------------------------------------------------------------------*/
  88. set_dir()
  89. {
  90. /* cheap way to do it but it works!!!  */
  91.  char *cmd;
  92.  screen(1);
  93.  color(yellow);
  94.  cmd="dir *.set";
  95.  system(cmd);
  96.  color(normal);
  97.  wait_key();
  98.  screen(0);
  99. }
  100. /*------------------------------------------------------------------*/
  101. patch_dir()
  102. {
  103. /* cheap way to do it but it works!!!  */
  104.  char *cmd;
  105.  screen(1);
  106.  color(yellow);
  107.  cmd="dir *.jx8";
  108.  system(cmd);
  109.  color(normal);
  110.  wait_key();
  111.  screen(0);
  112. }
  113. /*------------------------------------------------------------------*/
  114. copy_right()
  115. {
  116.  locate(1,1);
  117.  color(blue+bold);
  118.  printf("PC800 - JX8P Programmer/Voice Librarian 1.0");
  119.  locate(1,46);
  120.  color(green+bold);
  121.  printf("(C)opyright 1987 BP Midi Systems");
  122.  color(normal);
  123.    }
  124. /*------------------------------------------------------------------*/
  125. warning(p)  char *p;
  126. {
  127.  save_cursor();
  128.  locate(2,46);
  129.  color(yellow);
  130.  printf("warning - %s",p);
  131.  restore_cursor();
  132. }
  133. /*------------------------------------------------------------------*/
  134. xabort(code) int code;
  135. {
  136.  cls();
  137.  color(red+bold);
  138.  printf("\n\nA B O R T called - ");
  139.  color(yellow);
  140.  switch (code) {
  141.                 case(1): printf("sn_dta time out\n"); break;
  142.                 case(2): printf("sn_cmd time out\n"); break;
  143.                 case(5): printf("bad exclusive data\n"); break;
  144.                 case(7): printf("MPU version incorrect\n"); break;
  145.              default   : printf("undefined code=%d\n",code);
  146.                 }
  147.  color(brown);
  148.  printf("Closing Midi\n");
  149.  close_midi();
  150.  color(green+bold);
  151.  printf("Close successful\n");
  152.  color(normal);
  153.  exit(16);
  154. }
  155. /*------------------------------------------------------------------*/
  156. logo()
  157. {
  158.  cls();
  159.  color(blue+bold);
  160.  locate(7,20);
  161.  color(green+bold);
  162.  printf("PC800 - Roland JX8P Programmer/Librarian");
  163.  locate(9,22);
  164.  color(white+bold);
  165.  printf("(C)opyright 1987 BP Midi Systems");
  166.  locate(12,0);
  167.  color(normal);
  168. }
  169. /*------------------------------------------------------------------*/
  170.